#include <iostream>

template < typename T >
struct traits
{
	typedef typename T::value_type value_type;
};

template < typename T >
struct traits< T * >
{
	typedef T value_type;
};

template < typename T >
struct Iterator
{
	typedef T value_type;
	Iterator( T &t ) : m_t( &t) {}
	T &operator *() { return *m_t; }

private:
	T *m_t;
};

template < typename T >
typename traits< T >::value_type double_it( T it )
{
	return 2 * (*it );
}

int main( int argc, char *argv[] )
{
	int a = 10;
	int b = 11;
	Iterator< int > it(b);

	std::cout << double_it( &a ) << std::endl;
	std::cout << double_it( it ) << std::endl;
}

